/*
 * utils.h
 *
 *  Created on: 02/08/2009
 *      Author: matias
 */


#ifndef UTILS_H_
#define UTILS_H_

	#include <windows.h>

	typedef enum{
		HTML_FILE, JPG_FILE, BMP_FILE, PNG_FILE, GIF_FILE, ANY_FILE
	} e_file_type;

	#define DEFAULT_SPRINTF_BUFFER 500


	DWORD  utils_getNumberOf_CPUs(HANDLE currentHeap);

	int    utils_numdigitsOfInt(int x);
	int    utils_numdigitsOfLong(long x);
	int    utils_numdigitsOfFloat(float x);

	char  *utils_convertIntToString(HANDLE currentHeap, int x);
	char  *utils_convertIntToStringBuffer(HANDLE currentHeap, int x, char buffer[]);
	char  *utils_convertLongToString(HANDLE currentHeap, long x);
	char  *utils_convertFloatToString(HANDLE currentHeap, float f);

	char  *utils_string_replace(HANDLE currentHeap, const char *s1, const char *s2, const char *s3);
	int    utils_string_compare(char *s1, char *s2);
	char  *utils_string_clone(HANDLE currentHeap, char *s);
	char  *utils_string_buildFromTemplate(HANDLE currentHeap, const char *templateFormat, ...);
	int    utils_decodeFileExtension(char *extension);

	void   utils_decodeAnUrlData(HANDLE currentHeap, char *url,/*out*/char **ip,/*out*/int *port);
	char  *utils_getFileName_fromAnUrl(HANDLE currentHeap, char *url);

	int	   utils_isEven(int num);
	int	   utils_isOdd(int num);

#endif /*UTILS_H_*/
